from django.conf.urls.defaults import patterns

from views import main, block_page, legacy_page, legacy_codes, char_detail

urls = [
    (r'^block/(.*)/', block_page),
    (r'^char/(.*)/', char_detail),
]

for group_name, pages in legacy_codes:
    for page in pages:
        encodings = page.split()
        encoding = encodings[0]
        if len(encodings) > 1:
            aliases = ', '.join(encodings[1:])
        else:
            aliases = ''
        urls.append( (r'^legacy/%s/'%encoding, legacy_page,
                      {'encoding':encoding, 'aliases':aliases, 'title':group_name} ) )



urls.append( (r'^', main) )

urlpatterns = patterns('', *urls)
